home *** CD-ROM | disk | FTP | other *** search
/ Know Your Hockey - The Greatest Player Resource / Know Your Hockey: The Greatest Player Resource.iso / hockey / director / ssqcst.cst / 00121_Script_ButtonsObject < prev    next >
Text File  |  1998-09-28  |  4KB  |  129 lines

  1. property LastSelected,NowOn
  2.  
  3. on new me,which
  4.   set NowOn = []
  5.   set lastSelected = []
  6.   return me
  7. end
  8.  
  9. --which = sprite channel
  10. -- type-- annimation behavoiur 
  11. --1 no mousedown screen state
  12. --2 mousedown screen state
  13. -- 3 special case for pro and jr buttons
  14. -- action -- handler name or go to X
  15. -- clickit = puppetsound that you wantplayed for button click
  16.  
  17. global gButtonState
  18.  
  19. on button me, which,type,action,Clickit
  20.   put mousecast() into MB
  21.   if voidp(Clickit) = 0 then
  22.     puppetsound 0
  23.     puppetsound Clickit
  24.     updatestage
  25.   end if  
  26.   puppetsprite which,1  
  27.   -- behave according to type required
  28.   case type of
  29.       
  30.     1:  -- non sticky button does action on mousedown
  31.       losepop(window "pop")
  32.       repeat while stilldown()=1
  33.         if mousecast()= MB then
  34.           set the membernum of sprite which to MB+1
  35.           set the blend of sprite which = 100
  36.           updatestage
  37.           next repeat
  38.         end if
  39.         --return to normal whem off button
  40.         if (mousecast() <>MB+1)then 
  41.           set the membernum of sprite which to MB
  42.           set the blend of sprite which = 0
  43.           updatestage
  44.         end if
  45.         updatestage
  46.         if rollOver(which) then
  47.           do action
  48.         end if
  49.       end repeat
  50.       set the membernum of sprite which to MB  
  51.     2:  
  52.       -- threestate button that sticks 
  53.       set clicked = getat(gbuttonstate,which)
  54.       if clicked = 0 then 
  55.         
  56.         repeat while stilldown()=1  
  57.           if mousecast()= MB then 
  58.             set the membernum of sprite which = MB+1
  59.             set the blend of sprite which = 100
  60.             updatestage
  61.           end if
  62.           --return to normal whem off button
  63.           if (mousecast() <>MB+1)then  
  64.             set the member of sprite which to MB
  65.             set the blend of sprite which = 0
  66.             updatestage
  67.           end if 
  68.         end repeat
  69.       else
  70.         puppetsound 0
  71.         losepop(window "pop")
  72.         setat(gbuttonstate,clickon(),0)
  73.         set the membernum of sprite which = MB-1
  74.         updatestage
  75.         exit
  76.       end if
  77.       if rollOver(which) then
  78.         puppetsound 0
  79.         set the membernum of sprite which = MB+1-- see note
  80.         setat(gbuttonstate,which,2)
  81.         updatestage
  82.         do action
  83.       end if
  84.     3:  
  85.       -- threestate button that sticks 
  86.       set clicked = getat(gbuttonstate,which)
  87.       if clicked = 0 then 
  88.         
  89.         repeat while stilldown() = 1 
  90.           if mousecast()= MB then 
  91.             set the membernum of sprite which = MB+1
  92.             set the blend of sprite which = 100
  93.             updatestage
  94.           end if
  95.           --return to normal whem off button
  96.           if (mousecast() <>MB+1)then  
  97.             set the member of sprite which to MB
  98.             set the blend of sprite which = 0
  99.             updatestage
  100.           end if
  101.           updatestage
  102.         end repeat
  103.       else
  104.         setat(gbuttonstate,clickon(),0)
  105.         set the membernum of sprite 25= 59
  106.         set the membernum of sprite 24= 57
  107.         updatestage
  108.         do action
  109.         exit
  110.       end if
  111.       if rollOver(which) then
  112.         puppetsound 0
  113.         set the membernum of sprite which = MB+1-- see note
  114.         setat(gbuttonstate,which,2)
  115.         updatestage
  116.         do action
  117.       end if
  118.   end case
  119. end
  120.  
  121. --in bad performance situations the button script did not get executed until
  122. -- the mouse button was up ... as a result the icon would not be updated
  123. -- to avoid this  we added a forced update to the icon just before the do command
  124. -- which always excutes including on mouse up
  125.  
  126.  
  127.  
  128.  
  129.